Skip to content

Add Google reCAPTCHA v3 infrastructure#471

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-google-recaptcha
Draft

Add Google reCAPTCHA v3 infrastructure#471
Copilot wants to merge 2 commits intomainfrom
copilot/add-google-recaptcha

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 28, 2026

Adds Google reCAPTCHA v3 support as spam protection infrastructure for future forms (feedback form #316, email forms, etc.).

Service Layer

  • IReCaptchaService / ReCaptchaService in PC2/Services/ — verifies tokens against Google's API via IHttpClientFactory, validates v3 score against configurable threshold (default 0.5), logs all failure paths

Configuration

  • GoogleReCaptcha:SiteKey, SecretKey, MinimumScore added to appsettings.json with placeholder values; secrets go in user secrets / Azure App Settings
  • AddHttpClient() + IReCaptchaService registered in Program.cs

Client-Side Partial

  • Views/Shared/_ReCaptchaScriptsPartial.cshtml — loads reCAPTCHA v3 script, exposes getReCaptchaToken(action) JS helper; renders nothing if SiteKey is unconfigured
<!-- Include in any view that needs reCAPTCHA -->
<partial name="_ReCaptchaScriptsPartial" />
// On form submit
const token = await getReCaptchaToken('contact');
// POST token with form; server calls IReCaptchaService.VerifyAsync(token)

Tests & Docs

  • Config tests for all three GoogleReCaptcha keys
  • README section with dotnet user-secrets setup steps for local dev
Original prompt

This section details on the original issue you should resolve

<issue_title>Add Google reCAPTCHA</issue_title>
<issue_description>Google reCAPTCHA needs to be implemented for spam protection. This will be used for the future feedback form (#316) and any email forms that need to be added.

Add instructions to README to configure for development</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: JoeProgrammer88 <7156063+JoeProgrammer88@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Google reCAPTCHA for spam protection Add Google reCAPTCHA v3 infrastructure Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Google reCAPTCHA

2 participants